package com.zj.aopspringboot01;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component //将切面类声明为一个bean
@Aspect //声明这是一个切面类
public class LogAspect4 {
    @AfterThrowing(value = "execution(* com.zj.aopspringboot01.UserService.*(..))" ,throwing = "ex") //声明这是一个环绕通知
    public void logAdd(JoinPoint pj,Exception ex) {
        //异常通知部分
        System.out.println("AfterThrowing: " +ex.getMessage());

    }
}
